<template>
    <el-tree-select v-model="value" :data="parentData" :render-after-expand="false"
        :props="{ value: 'id', label: 'name', children: 'children' }" class="w100" clearable check-strictly
        :placeholder="$t('ProdCategory.inputPidTip')">
    </el-tree-select>
</template>
<script lang="ts" setup>
import { getTree, } from '/@/api/bizs/ProdCategory'

const props = defineProps(['update:modelValue'])
const value = ref()
// 上级菜单数据
const parentData = ref([])

// 从后端获取菜单信息（含层级）
const getAllMenuData = () => {
    parentData.value = [];
    getTree({
        type: '0',
    }).then((res) => {
        let menu = {
            id: '-1',
            name: '根菜单',
            children: [],
        };
        menu.children = res.data;
        parentData.value.push(menu);
    });
};
getAllMenuData();
</script>